@extends('layout.admin')

@section('title')
<title>用户列表</title>
@endsection

@section('content')
<style>
#search{
    margin-top:10px;
	width:70px;
	height:30px;
}
#fox{
	margin-left:115px;
}
#fox input[type='text']{
	border-radius: 30px;
}
#fox button{
	border-radius:100px;
}
</style>
<form action="/user">
     <div class="col-md-4" style="padding-left:0px">
      <select name="num" id="search">
      <option value="10" @if($request->num == 10) selected @endif >10</option>    
      <option value="20" @if($request->num == 20) selected @endif >20</option>    
      <option value="30" @if($request->num == 30) selected @endif >30</option>    
      <option value="40" @if($request->num == 40) selected @endif >40</option>
      <option value="50" @if($request->num == 50) selected @endif >50</option>     
      </select>
      <button type="submit" class="btn btn-default" style="background:#ECEDF0;border:0px"><i class="fa fa-search" ></i></button>
     </div> 
  </form> 
	<form action="/user" class="navbar-form navbar-left" role="search" id="fox">
		  <div class="form-group">
		    <input type="text" class="form-control" name="username" value="{{$request->username}}" placeholder="username">
		  </div>
		  <div class="form-group">
		    <input type="text" name="email" value="{{$request->email}}" class="form-control" placeholder="email">
		  </div>
		  <div class="form-group">
		    <input type="text" name="phone" value="{{$request->phone}}" class="form-control" placeholder="phone">
		  </div>
		  <button type="submit" class="btn btn-default" style="background:#ECEDF0"><i class="fa fa-search" ></i></button>
  </form>
  <div class="row"> 
   <div class="col-lg-12">

    <div class="panel"> 
      @if(count($errors)>0)
      <div class="alert alert-danger">
        出错啦哦!!!
        @foreach($errors->all() as $error)
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>{{$error}}</strong>
        @endforeach
      </div>
      @endif
     <div class="panel-heading bk-bg-primary"> 
      <h6><i class="fa fa-table red"></i><span class="break">用户列表</span></h6> 
      <div class="panel-actions"> 
       <a class="btn-setting" href="#"><i class="fa fa-rotate-right"></i></a> 
       <a class="btn-minimize" href="#"><i class="fa fa-chevron-down"></i></a> 
       <!-- <a class="btn-close" href="#"><i class="fa fa-times"></i></a>  -->
      </div> 
     </div>

     <div class="panel-body"> 
      <div class="table-responsive"> 
       <table class="table table-striped table-bordered table-hover bootstrap-datatable datatable"> 
        <thead> 
         <tr> 
          <th class="center">ID</th> 
          <th class="center">用户名</th> 
          <th class="center">性别</th> 
          <th class="center">邮箱</th> 
          <th class="center">手机号</th> 
          <th class="center">头像</th> 
          <th class="center">操作</th> 
         </tr> 
        </thead> 
        <tbody> 
        @foreach($user as $k=>$v)
         <tr> 
          <td class="center">{{$v['id']}}</td> 
          <td class="center">{{$v['username']}}</td> 
          <td class="center">{{$v['sex']?'男':'女'}}</td> 
          <td class="center">{{$v['email']}}</td> 
          <td class="center">{{$v['phone']}}</td> 
          <td class="center"><img style="width:50px;height:50px" src="{{$v->profile}}" class="img-circle"></td> 
          <td class="center">
          <a href="/user/{{$v->id}}/edit" class="btn btn-info btn-sm pull-left"><i class="fa fa-edit"></i></a> 
          <form action="/user/{{$v->id}}" method="post">
			       <input type="hidden" name="_method" value="delete">
			         {{csrf_field()}}
			       <button class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i></button>
          </form>
          </td> 
         </tr> 
         @endforeach 
        </tbody> 
       </table>
       <div id="pages">
	   		{!!$user->appends($request->all())->render()!!}
	   </div> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div>
  <style>
	#pages{
		float:right;
	}
  </style>
@endsection